﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QL_DTTN.DTO.DTO;
namespace QL_DTTN.TTTS.BUS
{
   public static class ThiSinh_Bus
    {
       public static double DiemDau(string soBaoDanh)
       {
           return new ThiSinh().DiemDau(soBaoDanh);
       }
       public static DataTable dataTable()
       {
           return new ThiSinh().selectAll();
       }
       public static ThiSinh getThiSinh(string soBaoDanh)
       {
           return new ThiSinh().getThiSinh(soBaoDanh);
       }
       public static bool Them(ThiSinh thiSinh)
       {
           return new ThiSinh().Them(thiSinh);
       }
       public static bool Them(List<ThiSinh> lstThiSinh)
       {
           return new ThiSinh().Them(lstThiSinh);
       }
       public static bool Sua(ThiSinh thiSinh) 
       {
           return new ThiSinh().Sua(thiSinh);
       }
       public static bool Xoa(string soBaoDanh)
       {
        return new ThiSinh().Xoa(soBaoDanh);
       }
       public static int getMaxID(string tiento)
       {
           return new ThiSinh().getMaxID(tiento);
       }
       public static string getNewSoBaoDanh(string tiento)
       {
           int maxid = new ThiSinh().getMaxID(tiento);
          
           if (maxid==-1)
           {
               return "";
           }
           else
           {
               return getID(tiento, maxid + 1, 10);
           }
       }
       public static DataTable getData(string key, Int16? maTinh, string maTruong, Int16? maHeDaoTao, string maDoiTuong, Int64? maKyThi) {
           return new ThiSinh().getData(key, maTinh??0, maTruong, maHeDaoTao??0, maDoiTuong, maKyThi??0);
       }
       public static string getID(string tiento, int giatri)
       {
           return getID(tiento, giatri, 10);
       }
       private static string getID(string tiento, int giatri, int lenghtgiatri)
       {
           string gt = giatri.ToString();
           while (gt.Length < lenghtgiatri)
           {
               gt = "0" + gt;
           }
           return tiento.Trim() + gt;
       }
    }
}
